package com.ytf.test.seventh;

/**
 * @author: YTF
 * @date: 2024/11/6 16:01
 * @version: 1.0
 * @description:
 */
public class Car {

    public Engine engine = new Engine();
    public Wheel[] wheel = new Wheel[4];
    public Door leftDoor = new Door(),
            rightDoor = new Door();

    public Car() {
        for (int i = 0; i <wheel.length ; i++) {
            wheel[i] = new Wheel();
        }
    }

    public static void main(String[] args) {
        Car car = new Car();
        car.leftDoor.window.rollUp();
        car.wheel[0].inflate(72);
        car.engine.service();
        /**
         * Output:
         * Window.rollUp()
         * Wheel.inflate()
         * Engine.service()
         *
         * 总结
         */
    }
}
class Engine{
    public void start(){
        System.out.println("Engine.start()");
    }
    public void rev(){
        System.out.println("Engine.rev()");
    }
    public void stop(){
        System.out.println("Engine.stop()");
    }
    public void service(){
        System.out.println("Engine.service()");
    }
}
class Wheel{
    public void inflate(int psi){
        System.out.println("Wheel.inflate()");
    }
}
class Window{
    public void rollUp(){
        System.out.println("Window.rollUp()");
    }
    public void rollDown(){
        System.out.println("Window.rollDown()");
    }
}
class Door{
    public Window window = new Window();
    public void open(){
        System.out.println("Door.open()");
    }
    public void close(){
        System.out.println("Door.close()");
    }
}

